"""
__project__ = 'thc'
__file_name__ = 'select'
__author__ = 'thc'
__time__ = '2020/12/23/023 15:22'
__product_name = PyCharm
-*- coding:utf-8 -*-
"""

from selenium import webdriver
from time import sleep
import os
from selenium.webdriver.support.select import Select

driver = webdriver.Chrome()
path = os.path.dirname(os.path.abspath(__file__))
file_path = 'file:///' + path + '/form3.html'
driver.get(file_path)
driver.implicitly_wait(10)
se = driver.find_element_by_id("provise")
select = Select(se)
select.select_by_index(2)
sleep(2)
select.select_by_value('bj')
sleep(2)
select.select_by_visible_text('天津')
sleep(2)
select.deselect_all()
sleep(2)
for i in select.options:
    select.select_by_visible_text(i.text)
    print(i.text)
driver.quit()


























